/**
 * Created by JetBrains PhpStorm.
 * User: September5th
 * Date: 3/11/12
 * Time: 1:40 AM
 * To change this template use File | Settings | File Templates.
 */



Ext.define('EM.view.Body', {

    extend:'Ext.panel.Panel',

    requires:[
        'EM.view.folder.FolderTree',
        'EM.view.event.StatusBar',
        'EM.view.event.TimelineView'
    ],

    initComponent:function () {

        var me = this;

        var timelineView = Ext.create("EM.view.event.TimelineView", {
            id:'events-timeline-view',
            region:'center',
            selModel:new Ext.selection.TreeModel({ ignoreRightMouseSelection:false, mode:'MULTI'}),
            taskStore:Ext.create('EM.store.Events'),
            snapToIncrement:true, // Uncomment this line to get snapping behavior for resizing/dragging.
            startDate:Sch.util.Date.add(new Date(), Sch.util.Date.WEEK, -5),
            endDate:Sch.util.Date.add(new Date(), Sch.util.Date.WEEK, 10),
            viewPreset:'weekAndDayLetter',
            highlightWeekends:true,
            weekendsAreWorkdays:true,
            enableDependencyDragDrop:false,
            showTodayLine:true,
            loadMask:true,
            stripeRows:true,
            leftLabelField:{
                dataIndex:'Name',
                editor:{ xtype:'textfield' }
            },
            tbar:Ext.create('EM.view.event.StatusBar')
        });
        Ext.applyIf(this, {
            layout:{
                type:'border'
            },
            preventHeader:true,
            items:[
                {
                    xtype:'panel',
                    id:'control-panel',
                    width:200,
                    layout:{
                        type:'accordion'
                    },
                    collapsed:false,
                    collapsible:true,
                    preventHeader:true,
                    region:'west',
                    split:true,
                    items:[
                        Ext.create('EM.view.folder.FolderTree', {
                            collapsed:false,
                            hideCollapseTool:true,
                            id:'folders-panel',
                            title:'FOLDERS'
                        })
                    ]
                },
                {



                    xtype:'panel',
                    layout:{
                        type:'border'
                    },
                    preventHeader:true,
                    region:'center',
                    dockedItems:[
                        {
                            xtype:'toolbar',
                            width:'40',
                            id:'events-search-toolbar',

                            region:'center',
                            dock:'top',
                            items:[
                                Ext.create('Ext.form.ComboBox', {
                                    store:Ext.create('Ext.data.Store', {
                                        fields:['value'],
                                        data:[
                                            {"value":"Name"},
                                            {"value":"Venue"}
                                        ]
                                    }),
                                    width:70,
                                    value:"Name",
                                    queryMode:'local',
                                    displayField:'value',
                                    valueField:'value'
                                }),
                                {
                                    xtype:'textfield',
                                    enableKeyEvents:true,
                                    width:300
                                },
                                '->',
                                {
                                    xtype:'button',
                                    enableToggle:true,
                                    text:'Filters',
                                    id:'events-filter-button'
                                }
                            ]
                        }
                    ],
                    items:[
                        {
                            xtype:'panel',
                            layout:{
                                type:'border'
                            },
                            preventHeader:true,
                            region:'center',
                            items:[
                                {
                                    xtype:'panel',
                                    id:'events-panel',
                                    activeItem:0,
                                    layout:{
                                        type:'card'
                                    },
                                    preventHeader:true,
                                    region:'center',
                                    items:[
                                        timelineView
//                                        {
//                                            xtype:'panel',
//                                            id:'events-list-view',
//                                            title:'list'
//                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            xtype:'panel',
                            id:'events-filter-panel',
                            width:250,
                            hidden:true,
                            preventHeader:true,
                            region:'east'
                        }
                    ]


                }
            ]
        });

        this.callParent(arguments);
    }
});